import java.io.File;

public class serch {
    public static void main(String[] args) {
        serchfire(new File("D:\\"),"WeChat.exe");
    }
    public static void serchfire(File dir,String firename){
        if (dir==null || !dir.exists() || dir.isFile()){
            return;
        }
        File[] files = dir.listFiles();
        if (files != null && files.length > 0){
            for (File file : files) {
                if (file.isFile()){
                    if (file.getName().contains(firename)){
                        System.out.println("找到了，文件路径为：" + file.getAbsolutePath());
                    }
                }else {
                    serchfire(file,firename);
                }
            }
        }
    }
}
